package com.weiyuwqj.app.mobile.invite;

import com.weiyuwqj.api.service.BasUserInviteService;
import com.weiyuwqj.api.service.BasUserInfoService;
import com.weiyuwqj.api.common.Paginator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by huzj on 2016/9/20.
 */
@Controller
@RequestMapping(value = "/mobile/invite")
public class MobileInviteController {
    @Autowired
    private BasUserInviteService userInviteService;

    @Autowired
    private BasUserInfoService userInfoService;


    //用户绑定邀请人
    @ResponseBody
    @RequestMapping(value = "/inviteBinding",method = RequestMethod.POST)
    public Object inviteBinding(Integer userId,String inviteCode){
        Map map=userInviteService.inviteBinding(userId,inviteCode);
        return map;
    }

    //邀请人列表
    @ResponseBody
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public Object list(Paginator p,Integer userId){
        Map map=new HashMap();
        map.put("userId",userId);
        return userInviteService.getList(p,map);
    }

}
